package com.fengmi.controller;

import com.fengmi.dto.PageDTO;
import com.fengmi.entity.OmsOrder;
import com.fengmi.service.OmsOrderService;
import com.fengmi.service.StatOrderService;
import com.fengmi.vo.PageResultVO;
import com.fengmi.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @Author 123
 * @Date 2022/1/25 10:02
 * @Version 1.0
 */

@RestController
@RequestMapping("order")
@CrossOrigin
@Api(tags = "订单管理")
public class OrderController {

    @Autowired
    private StatOrderService statOrderService;

    @Autowired
    private OmsOrderService omsOrderService;


    @GetMapping("stat")
    @ApiOperation("统计订单信息")
    public ResultVO stat(String beginTime, String endTime) {
        return statOrderService.statOrderByTime(beginTime, endTime);
    }

    @PostMapping("page")
    @ApiOperation("订单信息分页条件展示")
    public PageResultVO<OmsOrder> findPage(@RequestBody PageDTO<OmsOrder> pageDTO) {
        return omsOrderService.selectOrdersByPageAndWhere(pageDTO);
    }

    @GetMapping("history/{orderId}")
    @ApiOperation("查看订单操作历史信息")
    public ResultVO findOrderOperationHistory(@PathVariable String orderId) {
        return omsOrderService.selectOperationHistoryByOrderId(orderId);
    }



}